
package tsb.com.html5.product.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import tsb.com.html5.base.BaseService;
import tsb.com.html5.product.dao.IProductInfoDao;
import tsb.com.html5.product.item.CategoryItem;
import tsb.com.html5.product.item.ProductItem;
import tsb.com.html5.product.item.ProductSubItem;
import tsb.com.html5.product.param.GetCategoryParam;
import tsb.com.html5.product.param.GetProductParam;

/**
 * The Class ProductService.
 */
public class ProductService extends BaseService implements IProductService {
	private static final long serialVersionUID = 1L;
	
	@Autowired
	private IProductInfoDao productInfoDao;

	/**
	 * Gets the product info dao.
	 *
	 * @return the product info dao
	 */
	public IProductInfoDao getProductInfoDao() {
		return productInfoDao;
	}

	/**
	 * Sets the product info dao.
	 *
	 * @param productInfoDao the new product info dao
	 */
	public void setProductInfoDao(IProductInfoDao productInfoDao) {
		this.productInfoDao = productInfoDao;
	}

	public List<CategoryItem> getAllCategory(GetCategoryParam parm) throws Exception {
		List<CategoryItem> categoryList = null;
		try{
			categoryList = (List<CategoryItem>) productInfoDao.getAllCategory(parm);
		}catch(Exception e){
			throw e;
		}
		return categoryList;
	}

	public List<ProductItem> getProduct(GetProductParam parm) throws Exception {
		List<ProductItem> productList = null;
		try{
			productList = productInfoDao.getProduct(parm);
		}catch(Exception e){
			throw e;
		}
		return productList;
	}

	public List<ProductSubItem> getProductSub(GetProductParam parm)
			throws Exception {
		List<ProductSubItem> productSubList = null;
		try{
			productSubList = productInfoDao.getProductSub(parm);
		}catch(Exception e){
			throw e;
		}
		return productSubList;
	}

}
